package cn.buk.tms.dto;

import cn.buk.tms.entity.misc.CustomerTpFlight;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * 企业客户的机票差旅政策
 * TP - Travel Policy
 */
public class CustomerTpFlightDto extends BaseTpDto {

  /**
   * 飞行时长, 分钟
   */
  private int flyTime;

  /**
   * 没有飞行时长限制，或小于飞行时长时的规定
   * 允许乘坐的舱位
   * F/C/Y
   */
  private String cabinClassBefore;

  /**
   * 有飞行时长要求，并且飞行时长大于等于规定时
   */
  private String cabinClassAfter;

  /**
   * 是否要求最低价
   * 0-不用
   * 1-是
   */
  private int needLowest;

  private String remark;

  private Date createTime;

  private Date lastUpdate;

  public static CustomerTpFlightDto createdBy(CustomerTpFlight tpFlight) {
    CustomerTpFlightDto dto = new CustomerTpFlightDto();
    BeanUtils.copyProperties(tpFlight, dto);

    dto.setPositionId(tpFlight.getCustomerPosition().getPositionId());
    dto.setPositionName(tpFlight.getCustomerPosition().getName());
    dto.setPositionLevel(tpFlight.getCustomerPosition().getVipLevel());

    return dto;
  }

  @Override
  public String toString() {
    return getCustomerId() + ", "
            + flyTime + ", "
            + cabinClassBefore + ","
            + cabinClassBefore + ", "
            + needLowest + ", "
            + getRemark();
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public Date getLastUpdate() {
    return lastUpdate;
  }

  public void setLastUpdate(Date lastUpdate) {
    this.lastUpdate = lastUpdate;
  }


  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public int getFlyTime() {
    return flyTime;
  }

  public void setFlyTime(int flyTime) {
    this.flyTime = flyTime;
  }

  public String getCabinClassBefore() {
    return cabinClassBefore;
  }

  public void setCabinClassBefore(String cabinClassBefore) {
    this.cabinClassBefore = cabinClassBefore;
  }

  public String getCabinClassAfter() {
    return cabinClassAfter;
  }

  public void setCabinClassAfter(String cabinClassAfter) {
    this.cabinClassAfter = cabinClassAfter;
  }

  public int getNeedLowest() {
    return needLowest;
  }

  public void setNeedLowest(int needLowest) {
    this.needLowest = needLowest;
  }
}
